<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>医院库房管理系统|库房信息</title>

    <link th:href="@{/css/bootstrap.min.css}" rel="stylesheet">
    <link th:href="@{/font-awesome/css/font-awesome.css}" rel="stylesheet">
    <link th:href="@{/css/plugins/toastr/toastr.min.css}" rel="stylesheet">
    <link th:href="@{/css/animate.css}" rel="stylesheet">
    <link th:href="@{/css/style.css}" rel="stylesheet">

</head>
<body>
    <!--主体-->
    <!--导航-->
    <div id="wrapper">
        <div th:replace="/manager/manager_page :: manager_nav(activeUri='WH',activeurl='info')">
        </div>
        <div id="page-wrapper" class="gray-bg">
            <!--标题-->
            <div th:include="/manager/manager_page :: manager_title"></div>
            <!--主体内容-->
            <div class="row wrapper border-bottom white-bg page-heading">
                <div class="col-lg-10">
                    <h2>材料入库</h2>
                    <ol class="breadcrumb">
                        <li>
                            <a th:href="@{/manager/index}">首页</a>
                        </li>
                        <li class="active">
                            <a th:href="@{/manager/warehousingInfo}"><strong>材料管理</strong></a>
                        </li>
                    </ol>
                </div>
            </div>
            <!--主体-->
            <div class="wrapper wrapper-content animated fadeInRight ecommerce">


                <div class="ibox-content m-b-sm border-bottom">
                    <form th:action="@{/manager/warehousingInfo}" >
                    <div class="row">
                        <div class="col-sm-3">
                            <div class="form-group">
                                <label class="control-label" for="use_name">材料名</label>
                                <input type="text" id="use_name" name="search_useName" value="" class="form-control">
                            </div>
                        </div>
                        <div class="col-sm-3">
                            <div class="form-group">
                                <label class="control-label" for="typeid">材料类型</label>
                                <select class="form-control" id="typeid" name="search_typeid" >
                                    <option value="" th:text="选择需要查询的材料类型" selected="selected"/>
                                    <option th:each="typelist:${usetype}" th:value="${typelist.id}" th:text="${typelist.name}"/>
                                </select>
                            </div>
                        </div>
                        <div class="col-sm-3">
                            <div class="form-group">
                                <label class="control-label" for="business">生产厂家</label>
                                <input type="text" id="business" name="search_business" value=""  class="form-control">
                            </div>
                        </div>
                        <div class="col-sm-3">
                            <div class="form-group">
                                <label class="control-label" for="number">当前库存</label>
                                <input type="text" id="number" name="search_number" value=""  class="form-control">
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="text-center"><input class="btn btn-info  dim" type="submit" value="搜索"/></div>
                    </div>
                    </form>
                </div>

                <div class="row">
                    <div class="col-lg-12">
                        <div class="ibox">
                            <div class="ibox-content">

                                <!--添加-->
                                <button type="button"  class="btn btn-success  dim" data-toggle="modal"  th:attr="data-target='#Add'">添加材料</button>
                                <div class="modal inmodal" th:attr="id='Add'" tabindex="-1" role="dialog"  aria-hidden="true">
                                    <div class="modal-dialog">
                                        <form th:action="@{/manager/wareHousingInfo/addUse}" method="post" enctype="multipart/form-data">
                                            <div class="modal-content animated fadeIn">
                                                <div class="modal-header">
                                                    <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                                                    <i class="fa"><h3>添加材料</h3></i>
                                                </div>
                                                <div class="modal-body">
                                                    <div class="form-group">
                                                        <div class="col-sm-3 control-label">
                                                            <h4 style="padding-top: 5px">材料名:</h4>
                                                        </div>
                                                        <div class="col-sm-7">
                                                            <input class="form-control" name="useName" value="" >
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="modal-body">
                                                    <div class="form-group">
                                                        <div class="col-sm-3 control-label">
                                                            <h4 style="padding-top: 5px">材料类型:</h4>
                                                        </div>
                                                        <div class="col-sm-7">
                                                            <select class="form-control"  name="typeid"  >
                                                                <option text="请选择材料类型"></option>
                                                                <option th:each="list:${usetype}"   th:value="${list.id}"  th:text="${list.name}" ></option>
                                                            </select>
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="modal-body">
                                                    <div class="form-group">
                                                        <div class="col-sm-3 control-label">
                                                            <h4 style="padding-top: 5px">材料价格:</h4>
                                                        </div>
                                                        <div class="col-sm-7">
                                                            <input class="form-control" name="price" value="" >
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="modal-body">
                                                    <div class="form-group">
                                                        <div class="col-sm-3 control-label">
                                                            <h4 style="padding-top: 5px">材料单位:</h4>
                                                        </div>
                                                        <div class="col-sm-7">
                                                            <input class="form-control" name="typeSize" value="" >
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="modal-body">
                                                    <div class="form-group">
                                                        <div class="col-sm-3 control-label">
                                                            <h4 style="padding-top: 5px">生产厂家:</h4>
                                                        </div>
                                                        <div class="col-sm-7">
                                                            <input class="form-control" name="business" value="" >
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="modal-body">
                                                    <div class="form-group">
                                                        <div class="col-sm-3 control-label">
                                                            <h4 style="padding-top: 5px">图片上传</h4>
                                                        </div>
                                                        <div class="col-sm-7">
                                                            <input class="btn btn-success " type="file" name="fileupload" >
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="modal-footer">
                                                    <button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
                                                    <input type="submit" class="btn btn-success  dim" value="添加材料"/>
                                                </div>
                                            </div>
                                        </form>
                                    </div>
                                </div>
                                <!--表单开始-->
                                <table class="footable table table-bordered toggle-arrow-tiny" data-page-size="10">
                                    <thead>
                                    <tr>

                                        <th class="text-center" data-sortable="true">材料 ID</th>
                                        <th class="text-center" data-hide="phone" >材料名</th>
                                        <th class="text-center" data-hide="phone" >材料类型</th>
                                        <th class="text-center" data-hide="phone" >材料价格</th>
                                        <th class="text-center" data-hide="phone,tablet"  >材料单位</th>
                                        <th class="text-center" data-hide="phone" >上架时间</th>
                                        <th class="text-center" data-hide="phone" >库存数量</th>
                                        <th class="text-center" data-hide="phone" >生产厂家</th>
                                        <th class="text-center">操作</th>

                                    </tr>
                                    </thead>
                                    <tbody>
                                    <tr th:each="use:${useList}">
                                        <td class="text-center"  th:text="${use.id}">
                                            材料id
                                        </td>
                                        <td class="text-center" th:text="${use.useName}">
                                            材料名
                                        </td>
                                        <td class="text-center" th:each="type:${usetype}" th:if="${use.typeid}==${type.id}" th:text="${type.name}" >
                                            材料类型
                                        </td>
                                        <td class="text-center" th:text="￥+${+use.price}">
                                            材料价格
                                        </td>
                                        <td class="text-center" th:text="${use.typeSize}">
                                            材料单位
                                        </td>
                                        <td class="text-center" th:text="${#dates.format(use.upTime,'yyyy年MM月dd日 HH:mm:ss')}">
                                            上架时间
                                        </td>
                                        <td class="text-center" th:text="${use.number}">
                                            仓库库存
                                        </td>
                                        <td class="text-center" th:text="${use.business}">
                                            生产商
                                        </td>
                                        <td class="text-center">
                                            <div class="btn-group">
                                                <button type="button" class="btn-white btn btn-xs"  data-toggle="modal" th:attr="data-target='#EditInfo'+${use.id}">编辑材料</button>
                                                <!--编辑功能弹窗-->
                                                <div class="modal inmodal" th:attr="id='EditInfo'+${use.id}" tabindex="-1" role="dialog"  aria-hidden="true">
                                                    <div class="modal-dialog">
                                                        <form th:action="@{/manager/wareHousingInfo/EditInfo(EditInfo=${use.id})}" method="post">
                                                        <div class="modal-content animated fadeIn">
                                                            <div class="modal-header">
                                                                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                                                                <i class="fa  modal-icon"><img width="128" height="128" th:src="@{'/img//'+${use.getImages()}}"></i>
                                                            </div>
                                                            <div class="modal-body">
                                                                <div class="form-group">
                                                                    <div class="col-sm-3 control-label">
                                                                        <h4 style="padding-top: 5px">材料名:</h4>
                                                                    </div>
                                                                    <div class="col-sm-7">
                                                                        <input class="form-control" name="useName" th:value="${use.getUseName()}">
                                                                    </div>
                                                                </div>
                                                            </div>
                                                            <div class="modal-body">
                                                                <div class="form-group">
                                                                    <div class="col-sm-3 control-label">
                                                                        <h4 style="padding-top: 5px">材料类型:</h4>
                                                                    </div>
                                                                    <div class="col-sm-7">
                                                                        <select class="form-control"  name="typeid"  >
                                                                            <option th:each="list:${usetype}"   th:value="${list.id}"  th:selected="${use.typeid}==${list.id}" th:text="${list.name}" ></option>
                                                                        </select>
                                                                    </div>
                                                                </div>
                                                            </div>
                                                            <div class="modal-body">
                                                                <div class="form-group">
                                                                    <div class="col-sm-3 control-label">
                                                                        <h4 style="padding-top: 5px">材料价格:</h4>
                                                                    </div>
                                                                    <div class="col-sm-7">
                                                                        <input class="form-control" name="price" th:value="${use.getPrice()}">
                                                                    </div>
                                                                </div>
                                                            </div>
                                                            <div class="modal-body">
                                                                <div class="form-group">
                                                                    <div class="col-sm-3 control-label">
                                                                        <h4 style="padding-top: 5px">材料单位:</h4>
                                                                    </div>
                                                                    <div class="col-sm-7">
                                                                        <input class="form-control" name="typeSize" th:value="${use.getTypeSize()}">
                                                                    </div>
                                                                </div>
                                                            </div>
                                                            <div class="modal-body">
                                                                <div class="form-group">
                                                                    <div class="col-sm-3 control-label">
                                                                        <h4 style="padding-top: 5px">生产厂家:</h4>
                                                                    </div>
                                                                    <div class="col-sm-7">
                                                                        <input class="form-control" name="business" th:value="${use.getBusiness()}">
                                                                    </div>
                                                                </div>
                                                            </div>
                                                            <div class="modal-body">
                                                                <div class="form-group" style="padding-bottom: 50px;">
                                                                    <div class="col-sm-3 control-label">
                                                                        <h4 style="padding-top: 5px">材料介绍:</h4>
                                                                    </div>
                                                                    <div class="col-sm-7">
                                                                        <textarea class="form-control" name="useShow" th:text="${use.getUseShow()}" rows="2"></textarea>
                                                                    </div>
                                                                </div>
                                                            </div>
                                                            <div class="modal-footer">
                                                                <button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
                                                                <input type="submit" class="btn btn-primary" value="更改"/>
                                                            </div>
                                                        </div>
                                                        </form>
                                                    </div>
                                                </div>
                                                <!--修改库存-->
                                                <button type="button"  class="btn-white btn btn-xs" data-toggle="modal"  th:attr="data-target='#Edit'+${use.id}">修改库存</button>
                                                <div class="modal inmodal" th:attr="id='Edit'+${use.id}" tabindex="-1" role="dialog"  aria-hidden="true">
                                                    <div class="modal-dialog">
                                                        <form th:action="@{/manager/wareHousingInfo/Edit(Edit=${use.id})}" method="post">
                                                            <div class="modal-content animated fadeIn">
                                                                <div class="modal-header">
                                                                    <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                                                                    <i class="fa  modal-icon"><img th:src="@{'/img/'+${use.getImages()}}"></i>
                                                                </div>
                                                                <div class="modal-body">
                                                                    <div class="form-group">
                                                                        <div class="col-sm-3 control-label">
                                                                            <h4 style="padding-top: 5px">材料名:</h4>
                                                                        </div>
                                                                        <div class="col-sm-7">
                                                                            <input class="form-control" name="useName" th:value="${use.getUseName()}" disabled="disabled">
                                                                        </div>
                                                                    </div>
                                                                </div>
                                                                <div class="modal-body">
                                                                    <div class="form-group">
                                                                        <div class="col-sm-3 control-label">
                                                                            <h4 style="padding-top: 5px">材料库存:</h4>
                                                                        </div>
                                                                        <div class="col-sm-7">
                                                                            <input class="form-control" name="number" th:value="${use.getNumber()}" >
                                                                        </div>
                                                                    </div>
                                                                </div>
                                                                <div class="modal-footer">
                                                                    <button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
                                                                    <input type="submit" class="btn btn-primary" value="修改库存"/>
                                                                </div>
                                                            </div>
                                                        </form>
                                                    </div>
                                                </div>
                                                <a class="btn-white btn btn-xs" th:href="@{/mangaer/wareHousingInfo(Delete=${use.id})}">暂停材料</a>
                                            </div>
                                        </td>
                                    </tr>
                                    </tbody>
                                    <tfoot>
                                    <tr>
                                        <td colspan="12" class="footable-visible">
                                            <ul class="pagination pull-right" style="margin-bottom: 0px;margin-top: 0px;">
                                                <li class="footable-page-arrow" th:if="${IPage.getCurrent()!= 1}">
                                                    <a data-page="first" th:href="@{/manager/warehousingInfo/(page=1)}" th:text="首页">
                                                    </a>
                                                </li>
                                                <li class="footable-page-arrow " th:if="${IPage.getCurrent()!=1}">
                                                    <a data-page="prev" th:href="@{/manager/warehousingInfo/(page=${IPage.getCurrent()-1})}">
                                                        <
                                                    </a>
                                                </li>
                                                <li class="footable-page active">
                                                    <a data-page="0"  th:text="${IPage.getCurrent()}">
                                                    </a>
                                                </li>
                                                <li class="footable-page-arrow" th:if="${IPage.getCurrent()!=IPage.getPages()}">
                                                    <a data-page="next" th:href="@{/manager/warehousingInfo/(page=${IPage.getCurrent()+1})}">
                                                        >
                                                    </a>
                                                </li>
                                                <li class="footable-page-arrow" th:if="${IPage.getCurrent()!=IPage.getPages()}" >
                                                    <a data-page="last"  th:href="@{/manager/warehousingInfo/(page=${IPage.getPages()})}" th:text="末页">
                                                    </a>
                                                </li>
                                            </ul>
                                        </td>
                                    </tr>
                                    </tfoot>
                                </table>

                            </div>
                        </div>
                    </div>
                </div>
        </div>

            <!--底部-->
            <div class="footer" th:include="/manager/manager_page :: manager_footer"></div>
    </div>
    <!-- Mainly scripts -->
    <script th:src="@{/js/jquery-2.1.1.js}"></script>
    <script th:src="@{/js/bootstrap.min.js}"></script>
    <script th:src="@{/js/plugins/metisMenu/jquery.metisMenu.js}"></script>
    <script th:src="@{/js/plugins/slimscroll/jquery.slimscroll.min.js}"></script>
        <script th:src="@{/js/plugins/toastr/toastr.min.js}"></script>
        <script language="JavaScript">
            function hint(Info){
                if (Info != "") {
                    msg(Info);
                }
            };
            function msg(Info){
                if(Info=="true"){
                    toastr[success]("材料信息修改成功");
                    toastr.options = {
                        "closeButton": true,
                        "debug": true,
                        "progressBar": true,
                        "preventDuplicates": true,
                        "positionClass": "toast-top-right",
                        "onclick": null,
                        "showDuration": "10",
                        "hideDuration": "1000",
                        "timeOut": "7000",
                        "extendedTimeOut": "1000",
                        "showEasing": "swing",
                        "hideEasing": "linear",
                        "showMethod": "fadeIn",
                        "hideMethod": "fadeOut"
                    };
                }else{
                    toastr[error]("Hi, welcome to Inspinia. This is example of Toastr notification box.");
                    toastr.options = {
                        "closeButton": true,
                        "debug": false,
                        "progressBar": true,
                        "preventDuplicates": true,
                        "positionClass": "toast-top-right",
                        "onclick": null,
                        "showDuration": "400",
                        "hideDuration": "1000",
                        "timeOut": "7000",
                        "extendedTimeOut": "1000",
                        "showEasing": "swing",
                        "hideEasing": "linear",
                        "showMethod": "fadeIn",
                        "hideMethod": "fadeOut"
                    };
                }
            }

        </script>
    <!-- Custom and plugin javascript -->
    <script th:src="@{/js/inspinia.js}"></script>
    <script th:src="@{/js/plugins/pace/pace.min.js}"></script>

</body>
</html>